﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WPF_ReactiveProperty_PathSearchUtil.Util
{
    public class Resp
    {
        private int code;
        private string message;
        private object date;

        public Resp(int code)
        {
            this.code = code;
        }

        public Resp(int code, string message)
        {
            this.code = code;
            this.message = message;
        }

        public Resp(int code, object date)
        {
            this.code = code;
            this.date = date;
        }

        public int Code { get => code; set => code = value; }
        public string Message { get => message; set => message = value; }
        public object Date { get => date; set => date = value; }

        public static Resp Success(object date)
        {
            return new Resp(0, date);
        }

        public static Resp Success()
        {
            return new Resp(0);
        }

        public static Resp Fail(string message)
        {
            return new Resp(-1, message);
        }

        public static Resp Cancel()
        {
            return new Resp(-2);
        }
    }
}
